Compressing textures

Kanzi supports ATC, ETC, and PVRTC algorithms for compressing textures, and compressed .dxt textures. If your target hardware supports any of these compression methods, you can greatly reduce the memory bandwidth of your application by using texture compression. Reducing the memory bandwidth is important for the performance of your application. If your application tries to read more data from the memory that the memory can handle, reading the memory becomes a performance bottleneck for your application.

The best performing compression level depends on your target device. High compression uses more CPU but less bandwidth, low compression uses less CPU but more bandwidth.

Kanzi applications send compressed textures directly to the GPU, reducing the amount of interchanged data and without preprocessing on the CPU side (for example, loading libJPEG or libPNG). For example, a 256 by 256 pixels RGB texture uses 196 kb (256 * 256 * 3). When compressed with ETC, the same texture uses 32 kb (256 * 256 / 2).

If your target hardware does not support any of these compression algorithms, in some cases raw image format can be faster than any compression algorithm. This is particularly true when processing single small images.

If your target hardware does not support the selected texture compression algorithm, when you run your Kanzi application on your target device, Kanzi prints a warning message to the log. Kanzi paints black the surfaces where you use compressed texture formats that your target hardware does not support.

Because OpenGL expects .dxt texture data to have bottom row first, compress .dxt files vertically flipped. Note that you can use the .dxt files in your Kanzi application, but the .dxt files are not supported in the Win32 emulation because of the GPU limitations. See Importing images.

Kanzi Studio compresses the images when you create the kzb file. See Preprocessing images.

NOTE

The Preview shows compressed image quality and memory use only for images compressed with the ETC compression. The Preview shows the original, uncompressed images for all other compression formats.

Using the ATC compression

To use the ATC compression:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to ATC.
  3. Set the ATC Compression Scheme property to:

Using the ETC compression

To use the ETC compression:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to the ETC compression you want to use:

Using the PVRTC compression

The PVRTC algorithm works best for photorealistic textures. Kanzi supports the PVRTC compression according to the PVRTC1 and PVRTC2 schemes. PVRTC2 has higher quality than PVRTC1, especially with textures requiring sharp alpha transitions, but it is not supported by all PowerVR hardware. Additionally, only Imagination Technologies hardware, or a desktop platform using a development emulator support PVRTC compression.

When using the PVRTC to compress textures, to get correct results, the textures must be square and the power of two in size.

To use the PVRTC compression:

  1. In Kanzi Studio in the Library select Resource Files > Images, and select the image for which you want to apply compression.
  2. In the Properties set the Target Format property to PVRTC.
  3. In the Properties set:

Preprocessing images

Kanzi Studio compresses the images when you create the kzb file. To manually preprocess images, in the Library > Resource Files > Images right-click one or more images you want to preprocess, and select Preprocess images.

Note that Kanzi can compress textures using the ATC, ETC, and PVRTC algorithms. See Using the Image node.

See also

Adjusting the data size

Loading resources in parallel

Using mipmaps

Filtering textures

Troubleshooting the performance of your application

Images and textures best practices

Best practices

Images